package

.service.impl;

import .entity.SsoAccount;
import .dao.SsoAccountDao;
import .service.SsoAccountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SsoAccount)表服务实现类
 *
 * @author dzy
 * @since 2021-07-21 10:25:05
 */
@Service("ssoAccountService")
public class SsoAccountServiceImpl implements SsoAccountService {
    @Resource
    private SsoAccountDao ssoAccountDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SsoAccount queryById(Integer id) {
        return this.ssoAccountDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<SsoAccount> queryAllByLimit(int offset, int limit) {
        return this.ssoAccountDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ssoAccount 实例对象
     * @return 实例对象
     */
    @Override
    public SsoAccount insert(SsoAccount ssoAccount) {
        this.ssoAccountDao.insert(ssoAccount);
        return ssoAccount;
    }

    /**
     * 修改数据
     *
     * @param ssoAccount 实例对象
     * @return 实例对象
     */
    @Override
    public SsoAccount update(SsoAccount ssoAccount) {
        this.ssoAccountDao.update(ssoAccount);
        return this.queryById(ssoAccount.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.ssoAccountDao.deleteById(id) > 0;
    }
}
